package io;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * 使用FileWriter追加数据
 */
public class OutputStreamDemo5 {
    public static void main(String[] args) throws IOException {
        File file=new File("mytest.txt");
        if(!file.exists()){
            file.createNewFile();
        }
        try(FileWriter fileWriter=new FileWriter(file,true)){
            fileWriter.append("\n喜喜");
            fileWriter.flush();
        }
    }
}
